;--------------------------------
;Include Modern UI
  !include "MUI2.nsh"
;--------------------------------
;General
  
  #Name and file
   Name "Get Linux 3.2"
   OutFile "Get Linux 3.2 Setup.exe"
   ShowInstDetails "show"
   ShowUninstDetails "show"
   SetCompressor "lzma"
   BrandingText "Made By: Dev-Fire"

  #Default installation folder
   InstallDir "$PROGRAMFILES\Get Linux"
  
  #Request application privileges
   RequestExecutionLevel admin
;--------------------------------
; Version Tab information for Setup.exe properties
  VIProductVersion 3.2.0.0
  VIAddVersionKey ProductName "Get Linux"
  VIAddVersionKey ProductVersion "3.2"
  VIAddVersionKey CompanyName "Dev-Fire"
  VIAddVersionKey FileVersion "3.2"
  VIAddVersionKey FileDescription "Get Linux 3.2 Setup"
  VIAddVersionKey LegalCopyright "Open Source"
  ;--------------------------------
;Interface Settings
   !define MUI_ABORTWARNING
   !define MUI_HEADERIMAGE
   !define MUI_HEADERIMAGE_LEFT
   !define MUI_HEADERIMAGE_BITMAP "Header.bmp"
   !define MUI_HEADERIMAGE_UNBITMAP "Header.bmp"
   !define MUI_WELCOMEFINISHPAGE_BITMAP "Welcome.bmp"
   !define MUI_UNWELCOMEFINISHPAGE_BITMAP "Welcome.bmp"
   !define MUI_ICON "icon.ico"
   !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-full.ico"
   !define MUI_FINISHPAGE_RUN "$INSTDIR\Get Linux.exe"
   !define MUI_FINISHPAGE_RUN_TEXT "Start Get Linux 3.2"
;--------------------------------
;Pages
   !insertmacro MUI_PAGE_WELCOME
   !insertmacro MUI_PAGE_LICENSE "License.txt"
   !insertmacro MUI_PAGE_DIRECTORY
   !insertmacro MUI_PAGE_INSTFILES
   !insertmacro MUI_PAGE_FINISH
   !insertmacro MUI_UNPAGE_WELCOME
   !insertmacro MUI_UNPAGE_CONFIRM
   !insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
   !insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Section
Section "Install"

  SetOutPath "$INSTDIR"
  
  #Remove old files
   Delete "$INSTDIR\Data\Settings.cfg"
   RMDir /r "$INSTDIR\Data\Icons"
  
  #Files & Folders for the install directory
   File "Get Linux.exe"
   File "Readme.html"
   File "GPL-3.0 License.html"
   File "Microsoft.WindowsAPICodePack.dll"
   File "Microsoft.WindowsAPICodePack.Shell.dll"
   CreateDirectory "$INSTDIR\Data"
   CreateDirectory "$INSTDIR\Data\Icons"
   
   SetOutPath "$INSTDIR\Data\Icons"
   File /r "Data\Icons\"
   
   SetOutPath "$INSTDIR"
  
  #Create desktop shortcut
   CreateShortCut "$DESKTOP\Get Linux.lnk" "$INSTDIR\Get Linux.exe" ""

  #Create start-menu items
   CreateDirectory "$SMPROGRAMS\Get Linux"
   CreateShortCut "$SMPROGRAMS\Get Linux\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
   CreateShortCut "$SMPROGRAMS\Get Linux\Get Linux.lnk" "$INSTDIR\Get Linux.exe" "" "$INSTDIR\Get Linux.exe" 0
  
  #Write uninstall information to the registry
   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Get Linux" "DisplayName" "Get Linux"
   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Get Linux" "DisplayVersion" "3.2"
   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Get Linux" "DisplayIcon" "$INSTDIR\Get Linux.exe,0"
   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Get Linux" "UninstallString" "$INSTDIR\Uninstall.exe"
   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Get Linux" "Publisher" "Dev-Fire"
   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Get Linux" "URLInfoAbout" "http://getlinux.sourceforge.net"
  
  #Store installation folder
   WriteRegStr HKCU "Software\Dev-Fire\Get Linux" "" $INSTDIR
  
  #Create uninstaller
   WriteUninstaller "$INSTDIR\Uninstall.exe"
  
SectionEnd
;--------------------------------
;Uninstall Section
Section "Uninstall"
   #Remove Start Menu launcher
    Delete "$SMPROGRAMS\Get Linux\Get Linux.lnk"
    Delete "$SMPROGRAMS\Get Linux\Uninstall.lnk"
	Delete "$DESKTOP\Get Linux.lnk"
	
   #Try to remove the Start Menu folder - this will only happen if it is empty
    RMDir "$SMPROGRAMS\Get Linux"
	
   #Delete installed files
    Delete "$INSTDIR\Get Linux.exe"
    Delete "$INSTDIR\Readme.html"
	Delete "$INSTDIR\GPL-3.0 License.html"
    Delete "$INSTDIR\Data\Settings.cfg"
	Delete "$INSTDIR\Microsoft.WindowsAPICodePack.dll"
    Delete "$INSTDIR\Microsoft.WindowsAPICodePack.Shell.dll"
   
   #Remove installed directories
	RMDir /r "$INSTDIR\Data\Icons"
	RMDir "$INSTDIR\Data"
	
   #Always delete uninstaller as the last action
	Delete "$INSTDIR\uninstall.exe"
	
   #Remove install directory
    RMDir /r "$INSTDIR"
   
   #Remove uninstaller information from the registry
	DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Get Linux"
	
SectionEnd
;--------------------------------